//
//  MXCommentsController.m
//  CatchBear
//
//  Created by 王启颖 on 2018/12/10.
//  Copyright © 2018年 王启颖. All rights reserved.
//

#import "MXCommentsController.h"
#import "MXCommentsView.h"

@interface MXCommentsController ()
@property(strong,nonatomic)MXCommentsView *tableview;
@end

@implementation MXCommentsController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"评论";
}

-(void)NavigationItemBack{
    [super NavigationItemBack];
    self.commentsBlock(self.model);
}

-(void)setModel:(MXHomePageModel *)model{
    _model = model;
    [self tableview];
}

#pragma mark - 懒加载 -
-(MXCommentsView *)tableview{
    if (!_tableview) {
        
        MXCommentsView *view = [[MXCommentsView alloc]initWithFrame:self.view.bounds];
        __weak typeof(self) weakself = self;
        view.commentsBlock = ^{
            weakself.model.messages_commentnum = weakself.model.messages_commentnum + 1;
        };
        view.messages_id  = self.model.messages_id;
        _tableview = view;
        _tableview.navigationController = self.navigationController;
        [self.view addSubview:_tableview];
    }
    return _tableview;
}

@end
